#include <glib.h>

gint main(gint argc, gchar **argv)
{
    GChecksum *checksum_a = NULL;
    GChecksum *checksum_b = NULL;
    GChecksum *checksum_ab1 = NULL;
    GChecksum *checksum_ab2 = NULL;

    checksum_a = g_checksum_new(G_CHECKSUM_MD5);
    g_checksum_update(checksum_a, "A", strlen("A"));
    g_print("MD5(A):%s \n", g_checksum_get_string(checksum_a));
    g_checksum_free(checksum_a);

    checksum_b = g_checksum_new(G_CHECKSUM_MD5);
    g_checksum_update(checksum_b, "B", strlen("B"));
    g_print("MD5(B):%s \n", g_checksum_get_string(checksum_b));
    g_checksum_free(checksum_b);

    checksum_ab1 = g_checksum_new(G_CHECKSUM_MD5);
    g_checksum_update(checksum_ab1, "AB", strlen("AB"));
    g_print("MD5(AB)(once):%s \n", g_checksum_get_string(checksum_ab1));
    g_checksum_free(checksum_ab1);

    checksum_ab2 = g_checksum_new(G_CHECKSUM_MD5);
    g_checksum_update(checksum_ab2, "A", strlen("A"));
    //ERROR // g_print("MD5(A):%s \n", g_checksum_get_string(checksum_ab2));
    g_checksum_update(checksum_ab2, "B", strlen("B"));
    g_print("MD5(AB)(update):%s \n", g_checksum_get_string(checksum_ab2));
    g_checksum_free(checksum_ab2);

    return 0;
}